//
//  PVDDetailNavigationView.swift
//  GreenDeal
//
//  Created by Moennig Q on 26/12/2022.
//

import UIKit

class JobDetailBaseView: UIView {
    let backToPreBtn = UIButton()
    let refreshBtn = UIButton()
    let titleLabel = ContentLabel(R.font.interBold(size: 18),hexStr: "#101E30FF")
    let subTitieLabel = ContentLabel(R.font.interMedium(size: 12),hexStr: "#292D32B2")
    //IB init
    required init?(coder aDecoder: NSCoder) {
        super.init(coder:aDecoder)
    }
    //纯代码创建
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.initNaviBar()
        self.setUpView()
    }
    func initNaviBar() {
        self.backgroundColor = UIColor(hexStr: Constant.SystemBackColor)
        //titleLabel
        titleLabel.numberOfLines = 2
        titleLabel.textAlignment = .center
        titleLabel.adjustsFontSizeToFitWidth = true
        self.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.top.equalTo(UIDevice.getStatusBarHeight() + 10)
            make.left.equalTo(48)
            make.right.equalTo(-48)
            make.height.greaterThanOrEqualTo(20)
        }
        //titleLabel
        self.addSubview(subTitieLabel)
        subTitieLabel.snp.makeConstraints { make in
            make.top.equalTo(titleLabel.snp.bottom).offset(3)
            make.height.width.greaterThanOrEqualTo(0)
            make.centerX.equalToSuperview()
        }
        backToPreBtn.setImage(R.image.navigation_bar_back_black_icon(), for: UIControl.State.normal)
        self.addSubview(backToPreBtn)
        backToPreBtn.snp.makeConstraints { make in
            make.left.equalTo(8)
            make.width.height.equalTo(40)
            make.centerY.equalTo(titleLabel.snp.bottom)
        }
        refreshBtn.setImage(R.image.installation_list_refresh_btn(), for: UIControl.State.normal)
        self.addSubview(refreshBtn)
        refreshBtn.snp.makeConstraints { make in
            make.right.equalTo(-8)
            make.width.height.equalTo(40)
            make.centerY.equalTo(backToPreBtn)
        }
    }
    func setTitleInfo(_ title: String?, subTitle: String?){
        self.titleLabel.text = title
        self.subTitieLabel.text = subTitle
    }
    func setUpView() {
        
    }
}
